import 'package:flutter/material.dart';
import 'package:flutter_dk_form/src/bean/title_content_bean.dart';

/// 通用标题
/// [title]:标题文本
/// [hasLine]：是否有下划线
class TitleWidget extends StatelessWidget {
  final String title;
  final bool hasLine;
  final TitleTextStyle titleTextStyle;

  TitleWidget(this.title,
      {this.hasLine = true,
      this.titleTextStyle = TitleTextStyle.TitleBigLight});

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Column(
      children: <Widget>[
        Container(
          width: double.infinity,
          height: titleTextStyle == TitleTextStyle.TitleBig
              ? 44
              : (titleTextStyle == TitleTextStyle.TitleBigLight ? 56 : 48),
          color: Colors.white,
          alignment: Alignment.centerLeft,
          padding: EdgeInsets.only(left: 16),
          child: Text(
            title,
            style: TextStyle(
                color: titleTextStyle == TitleTextStyle.TitleBigLight
                    ? Color(0xFF333333)
                    : Color(0xFF666666),
                fontSize:
                    titleTextStyle == TitleTextStyle.TitleSmall ? 14 : 16),
          ),
        ),
        Visibility(
            visible: hasLine,
            child: Divider(height: 0.5, indent: 16, color: Color(0xFFEBEBEB))),
      ],
    );
  }
}

enum TitleTextStyle {
  ///高度44，字体颜色#666666，字体大小16
  TitleBig,

  ///高度56，字体颜色#333333，字体大小16
  TitleBigLight,

  ///高度48，字体颜色#666666，字体大小14
  TitleSmall
}
